home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / virtualdub / VirtualDub-source-1_4d / DubSource.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-20  |  2.2 KB  |  85 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    Copyright (C) 1998-2001 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #include "DubSource.h"
  19.  
  20. DubSource::DubSource() {
  21.     format = NULL;
  22. }
  23.  
  24. DubSource::~DubSource() {
  25.     if (format) delete format;
  26. }
  27.  
  28. BOOL DubSource::init() {
  29.     return TRUE;
  30. }
  31.  
  32. void *DubSource::allocFormat(int format_len) {
  33.     if (format) delete format;
  34.  
  35.     return format = (void *)new char[this->format_len = format_len];
  36. }
  37.  
  38. bool DubSource::isStreaming() {
  39.     return false;
  40. }
  41.  
  42. int DubSource::read(LONG lStart, LONG lCount, LPVOID lpBuffer, LONG cbBuffer, LONG *lBytesRead, LONG *lSamplesRead) {
  43.     if (lStart < lSampleFirst) return AVIERR_BADPARAM;
  44.     if (lStart >= lSampleLast) {
  45.         if (lSamplesRead)
  46.             *lSamplesRead = 0;
  47.         if (lBytesRead)
  48.             *lBytesRead = 0;
  49.         return 0;
  50.     }
  51.  
  52.     if (lCount>0 && lCount > lSampleLast - lStart) lCount = lSampleLast - lStart;
  53.  
  54.     return _read(lStart, lCount, lpBuffer, cbBuffer, lBytesRead, lSamplesRead);
  55. }
  56.  
  57. BOOL DubSource::isKey(LONG lSample) {
  58.     if (lSample<lSampleFirst || lSample>=lSampleLast) return TRUE;
  59.  
  60.     return _isKey(lSample);
  61. }
  62.  
  63. BOOL DubSource::_isKey(LONG lSample) {
  64.     return TRUE;
  65. }
  66.  
  67. LONG DubSource::nearestKey(LONG lSample) {
  68.     return lSample;
  69. }
  70.  
  71. LONG DubSource::prevKey(LONG lSample) {
  72.     return lSample <= lSampleFirst ? -1 : lSample-1;
  73. }
  74.  
  75. LONG DubSource::nextKey(LONG lSample) {
  76.     return lSample+1 >= lSampleFirst ? -1 : lSample+1;
  77. }
  78.  
  79. void DubSource::streamBegin(bool fRealTime) {
  80. }
  81.  
  82. void DubSource::streamEnd() {
  83. }
  84.  
  85.